{% extends "base.html" %}

{% block content %}
<!-- 页头导航栏 -->
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #6c757d;">
    <div class="container">
        <a class="navbar-brand" href="#" id="logo">互助湖经</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
            aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav ms-auto">
        <!-- 首页 -->
        <li class="nav-item">
            <a class="nav-link active" aria-current="page" id="home-link" href="#">首页</a>
        </li>

        <!-- 博客 下拉菜单 -->
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
               data-bs-toggle="dropdown" aria-expanded="false">
                博客
            </a>
            <ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDropdown">
                <li><a class="dropdown-item" id="hot-blog-link" href="#">热门</a></li>
                <li><a class="dropdown-item" id="recent-blog-link" href="#">最新</a></li>
                <li><a class="dropdown-item" id="friend-link" href="#">交友</a></li>
                <li><a class="dropdown-item" id="help-link" href="#">求助</a></li>
                <li><a class="dropdown-item" id="trade-link" href="#">交易</a></li>
                <li><a class="dropdown-item" id="my-follow-link" href="#">我的关注</a></li>
                <li><a class="dropdown-item" id="similar-recommend-link" href="#">相似推荐</a></li>
            </ul>
        </li>

        <!-- 管理 下拉菜单 -->
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownManage" role="button"
               data-bs-toggle="dropdown" aria-expanded="false">
                管理
            </a>
            <ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDropdownManage">
                <li><a class="dropdown-item" id="my-posts-link" href="#">我的帖子</a></li>
                <li><a class="dropdown-item" id="my-comments-link" href="#">我的评论</a></li>
                <li><a class="dropdown-item" id="my-likes-link" href="#">我的点赞</a></li>
                <li><a class="dropdown-item" id="my-following-link" href="#">我的关注</a></li>
            </ul>
        </li>

        <!-- 设置 -->
        <li class="nav-item">
            <a class="nav-link" id="settings-link" href="#">设置</a>
        </li>

        <!-- 登出 -->
        <li class="nav-item">
            <a class="nav-link" id="logout-link" href="#">登出</a>
        </li>
    </ul>
</div>
    </div>
</nav>


<script>
document.addEventListener('DOMContentLoaded', () => {
    Fetch('{{ url_for('systemallnavurls') }}', 'GET', {}, async function (res) {
        if (res.status === 'success') {

            const data = res.data;

            // 设置首页链接
            const logo = document.getElementById('logo')
            const homeLink = document.getElementById('home-link');
            const blog_hot = document.getElementById('hot-blog-link')
            const recent_link = document.getElementById('recent-blog-link')
            const friend_link = document.getElementById('friend-link')
            const help_link = document.getElementById('help-link')
            const trade_link= document.getElementById('trade-link')
            const my_follow_link = document.getElementById('my-follow-link')
            const similar_link=document.getElementById('similar-recommend-link')

            logo.href = data['first_page']
            homeLink.href = data['first_page']
            blog_hot.href = data['blog_hot_page']
            recent_link.href = data['blog_recent_page']
            friend_link.href = data['blog_make_friends_page']
            help_link.href=data['blog_help_page']
            trade_link.href=data['blog_trade_page']
            my_follow_link.href=data['blog_my_following_page']
            similar_link.href=data['blog_similar_page']
        }
    });

})
</script>

    {% block main %}
{% endblock %}

{% endblock %}
